package test;

/*
 * Author: JacksonCoder
 * FileName: sortedDemo
 * Version: 1.0.0
 * Date: 2025/5/10
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class sortedDemo {

    public static void main(String[] args) {
        int[] nums = {123, 4142, 6546, 123, 941};
        ArrayList list = new ArrayList<>();
        for (int num : nums) {
            list.add(num);
        }
        Collections.sort(list);
        System.out.println(list);
        methodOfSorted(nums);

        String[] strs = {"alen", "bob", "chirs", "nexroa", "wusir"};
        List<String> strList = Arrays.stream(strs)
                .sorted()
                .collect(Collectors.toList());
        System.out.println("strList :" + strList);
    }

    public static void methodOfSorted(int[] nums) {
        List<Integer> list = Arrays.stream(nums)
                .boxed()
                .sorted()
                .collect(Collectors.toList());
        System.out.println("这里是methodOfSorted: " + list);
    }

}
